The technology described herein relates to a method of and apparatus for encoding data, and in particular to such a method and apparatus for use to compress texture data for use in computer graphics systems.
It is common in computer graphics systems to generate colours for sampling positions in the image to be displayed by applying so-called textures or texture data to the surfaces to be drawn. For example, surface detail on objects may be generated by applying a predefined “texture” to a set of polygons representing the object, to give the rendered image of the object the appearance of the “texture”. Such textures are typically applied by storing an array of texture elements or “texels”, each representing given texture data (such as colour, luminance, and/or light/shadow, etc. values), and then mapping the texels onto the corresponding elements, such as (and, indeed, typically) a set of sampling positions, for the image to be displayed. The stored arrays of texture elements (data) are typically referred to as “texture maps”.
Such arrangements can provide high image quality, but have a number of drawbacks. In particular, the storage of the texture data and accessing it in use can place, e.g., high storage and bandwidth requirements on a graphics processing device (or conversely lead to a loss in performance where such requirements are not met). This is particularly significant for mobile and handheld devices that perform graphics processing, as such devices are inherently limited in their, e.g., storage, bandwidth and power resources and capabilities.
It is known therefore to try to encode such texture data in a “compressed” form so as to try to reduce, e.g., the storage and bandwidth burden that may be imposed on a device.
One known such texture data compression technique determines a set or palette of colours to be used for, e.g., a given texture map, and then stores for each texture element (texel) in the texture map an index into the set or palette of colours, indicating the colour to be used for that texel. This has the advantage that only an index, rather than a full (e.g.) colour value needs to be stored for each texel. This helps to reduce, e.g., the texture data storage requirements, but still has some drawbacks, such as in terms of reduced image quality and the necessary data processing.
Another known texture compression technique is to use so-called block truncation coding (BTC). In this technique the overall texture array (texture map) is subdivided into smaller blocks, e.g. of 4×4 texels, and a number (typically two) of base or primary colour values are determined for each such block, with each texel in the block being set to one of the base colour values. This again saves on the data that has to be stored and accessed, but at a cost of lower image quality.
S3 Incorporated of California, USA, have proposed in their U.S. Pat. No. 5,956,431 an improved block truncation coding technique. In this technique, two base colours are again stored for each texel block, but two additional colours to be used for the block are also derived from those two base colours (e.g. by linearly blending those colours). In this way, four colours are provided as a “palette” for the texel block, but only two colour values need to be stored for the block. Each texel in the block is then encoded using two bits, to indicate which of the four block “colours” should be used for the texel. This system provides improved image quality over basic block truncation coding, but requires more data per block.
It is also known in some texture compression schemes, such as BC6 and BC7, to divide the set of texture data elements that is encoded in a given texture data block into plural “sub-sets” or “partitions” of texture data elements.
In these arrangements, each texture data element partition for the texture data block (i.e. sub-set of the texture data elements that the texture data block encodes) then has its own set of base (e.g. endpoint) colour values and so can, effectively, be reproduced independently of the other partitions of the block. This can help to enhance the reproduced image quality, e.g. where the block to be encoded includes distinct colour partitions.
In these arrangements, the encoding scheme typically supports a finite set of allowed partitioning patterns, because of the need to be able to indicate (efficiently) to the decoder which partitioning pattern has been used for a given encoded texture data block. (This is typically done by including a partitioning pattern index in the encoded texture data block that the decoder can then use to identify the partitioning pattern that has been used).
When encoding a given texture data block, it is accordingly necessary to determine which one of the supported set of partitioning patterns to use for the block. This is typically done by test encoding the block using each possible partitioning pattern, determining which of the patterns gives the best result, and then using that pattern as the pattern to use to encode the block.
While such “brute force” partitioning pattern testing may work satisfactorily where there is only a limited number of possible partitioning patterns in the supported set of partitioning patterns, the Applicants have recognised that such techniques may not be so suitable as the number of possible partitioning patterns in the supported set of partitioning patterns increases (as the time needed to test a large number of partitioning patterns in this way may become too large).
The Applicants believe therefore that there remains scope for improved techniques for determining the partitioning pattern to use when, e.g., encoding texture data for graphics processing.
Like numerals are used for like features in the drawings (where appropriate).